package vista;

import javax.swing.*; 
import org.jdatepicker.impl.JDatePanelImpl;
import org.jdatepicker.impl.JDatePickerImpl;
import org.jdatepicker.impl.UtilDateModel;
import java.awt.*; 
import java.awt.event.*; 
import java.text.DateFormat; 
import java.text.SimpleDateFormat;
import java.util.Calendar; 
import java.util.Date;
import java.util.Properties;


public class selectDate extends JFrame implements ActionListener{
JLabel CheckDate; JButton check;
public UtilDateModel model;
public JDatePanelImpl datePanel;
public JDatePickerImpl datePicker;
public selectDate()
    {
    model = new UtilDateModel();  
    datePanel = new JDatePanelImpl(model, new Properties());  
    datePicker = new JDatePickerImpl(datePanel,null);
    JPanel panel=new JPanel();
    CheckDate=new JLabel("Date:");
    check=new JButton("CHECK"); 
    check.addActionListener(this);
    panel.add(CheckDate);
    panel.add(datePicker);
    panel.add(check);
    add(panel);
    setBounds(200,150,400,300);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setResizable(false);
    setVisible(true); 
    }
public void actionPerformed(ActionEvent e) 
    {if(check==e.getSource())
    {
    Date selectedDate = (Date) datePicker.getModel().getValue();
    DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
    String reportDate = df.format(selectedDate);
    JOptionPane.showMessageDialog(null,reportDate);
    }}}